<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Permissions extends Admin_Controller {

	public $model = "permission";
	public $view = "permissions";
	public $permissionCreate = 'Permissions.Create';
    public $permissionDelete = 'Permissions.Delete';
    public $permissionEdit   = 'Permissions.Edit';
    public $permissionView   = 'Permissions.View';
	
	protected $index_show = array(
		array( 'field' => 'permission_id',
				'label' => 'permission id'),	
		array( 'field' => 'permission_name',
				'label' => 'permission name',
				'custom_value' => '<a href="{url_edit}{permission_id}">{permission_name}</a>', //replace value
				),
		array( 'field' => 'permission_description',
				'label' => 'permission description'),
	);

    function __construct() {
        parent::__construct();
        $this->load->model($this->model.'_m',$this->model);
		$this->_model = $this->{$this->model};
    }
    function index3($page = 0)
    {
		$this->load->library('datatables');
		$this->load->model('setting_m');
		$this->datatables->select('setting_id,setting_name');
			$this->datatables->from('setting');
			$this->datatables->add_column('edit', '<a href="profiles/edit/$1">EDIêT</a>', 'setting_name');
			$this->datatables->add_column('title', '<a href="profiles/edit/$1">XXX</a>', 'setting_name');
			$this->datatables->set_display('setting_id', 'OK');
			$results = $this->datatables->generate('json');
		if($this->input->post())
		{
				
			// prd($this->datatables->gets_title_columns());
			die($results);
		}
		// $this->data['r'] = $results;
		$this->data['r'] = json_encode(array(
			'columns' => array(
				array('data' => 'setting_id','title'=>'haha'),
				array('data' => 'edit'),
				array('data' => 'setting_name'),
				array('data' => 'title'),
				),
			)

		);
		$this->data['r'] =substr($this->data['r'],1);
		$this->data['r'] =substr($this->data['r'], 0,-1);
		$this->theme_data["main"] = "permissions/index_test";
			$this->template->viewAdmin($this->theme_data, $this->data);

    }
}
